package com.desay.pangoo.itmt.entity;

import java.io.Serializable;
import java.util.Objects;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.Data;

/**
 * tech_online_review_tmt :TMT审核
 * 
 * @author uidq1163
 *
 */
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "tech_online_review_tmt")
@Data
@JsonIgnoreProperties({ "techOnlineReview", "techOnlineRelevantReview" })
public class TechOnlineReviewTMTEntity extends BaseEntity implements Serializable {

	private static final long serialVersionUID = -7098169864507997258L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", columnDefinition = "bigint COMMENT '主键'")
	private Long id;

	/**
	 * isParticipate：null-未参会， isParticipate：false-参会弃权评审，isParticipate： true-参会
	 */
	@Column(name = "is_participate", nullable = true, columnDefinition = "bit COMMENT 'TMT反馈是否参与'")
	private Boolean isParticipate;

	@Column(name = "is_passed", nullable = true, columnDefinition = "bit COMMENT '评审结果：1通过，0不通过'")
	private Boolean isPassed;

	@Column(name = "review_content", nullable = true, columnDefinition = "text COMMENT '评审内容'")
	private String reviewContent;

	@Column(name = "description", nullable = true, columnDefinition = "mediumtext COMMENT '说明'")
	private String description;

	@Column(name = "tmt_user", nullable = false, columnDefinition = "text COMMENT 'TMT成员用户:uid'")
	private String tmtUser;

	@Column(name = "tmt_full_user", nullable = true, columnDefinition = "text COMMENT 'TMT成员用户昵称'")
	private String tmtFullUser;

	@Column(name = "tmt_mail", nullable = false, columnDefinition = "text COMMENT 'TMT成员用户:邮件信息'")
	private String tmtMail;

	@ManyToOne(fetch = FetchType.EAGER, optional = true)
	@JoinColumn(name = "tech_online_review_id")
	@JsonIgnoreProperties({ "parent", "children" })
	private TechOnlineReviewEntity techOnlineReview;

	@ManyToOne(fetch = FetchType.EAGER, optional = true)
	@JoinColumn(name = "relevant_id")
	private TechOnlineReviewRelevantEntity techOnlineRelevantReview;

	@ManyToOne(fetch = FetchType.EAGER, optional = true)
	@JoinColumn(name = "work_group_id")
	private WorkGroupEntity workGroup;

	@Column(name = "judgesType", nullable = true, columnDefinition = "int default 1 COMMENT '评委类型:正式参会人员:1，旁听人员:2'")
	private Integer judgesType;

	/** 需求重要性Need */
	@Column(name = "need", nullable = true, columnDefinition = "int default 0 COMMENT '需求重要性'")
	private Integer need;

	/** 技术成熟度Maturity */
	@Column(name = "maturity", nullable = true, columnDefinition = "int default 0 COMMENT '技术成熟度'")
	private Integer maturity;

	/** 行业区别度Diffrentiation */
	@Column(name = "diffrentiation", nullable = true, columnDefinition = "int default 0 COMMENT '行业区别度'")
	private Integer diffrentiation;

	/** 潜在成本优势Cost Saving */
	@Column(name = "cost_saving", nullable = true, columnDefinition = "int default 0 COMMENT '潜在成本优势'")
	private Integer costSaving;

	@Column(name = "is_cross", nullable = true, columnDefinition = "bit COMMENT '是否跨域技术'")
	private Boolean isCross;

	/** 技术领先性:领先 追平 落后 （ 三选一） */
	@Column(name = "technology_leadership", nullable = true, columnDefinition = "int COMMENT '技术领先性'")
	private Integer technologyLeadership;

	/** 技术贡献性:主要卖点 次要卖点 基础技术 （ 三选一） */
	@Column(name = "technology_contribution", nullable = true, columnDefinition = "int COMMENT '技术贡献性'")
	private Integer technologyContribution;

	/** 核心技术 */
	@Column(name = "core_technology", nullable = true, columnDefinition = "int COMMENT '核心技术'")
	private Integer coreTechnology;

	/** PLTMTleader标识 */
	@Column(name = "is_PL", nullable = true, columnDefinition = "int COMMENT '0 tmt leader评审，1 pltmt leader 首次评审，2 pltmt leader二次评审'")
	private Integer isPL;

	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (!super.equals(obj)) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		TechOnlineReviewTMTEntity other = (TechOnlineReviewTMTEntity) obj;
		return Objects.equals(costSaving, other.costSaving) && Objects.equals(description, other.description)
				&& Objects.equals(diffrentiation, other.diffrentiation) && Objects.equals(id, other.id)
				&& Objects.equals(isCross, other.isCross) && Objects.equals(isParticipate, other.isParticipate)
				&& Objects.equals(isPassed, other.isPassed) && Objects.equals(judgesType, other.judgesType)
				&& Objects.equals(maturity, other.maturity) && Objects.equals(need, other.need)
				&& Objects.equals(reviewContent, other.reviewContent)
				&& Objects.equals(techOnlineRelevantReview, other.techOnlineRelevantReview)
				&& Objects.equals(techOnlineReview, other.techOnlineReview)
				&& Objects.equals(tmtFullUser, other.tmtFullUser) && Objects.equals(tmtMail, other.tmtMail)
				&& Objects.equals(tmtUser, other.tmtUser) && Objects.equals(workGroup, other.workGroup);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + Objects.hash(id);
		return result;
	}

}
